/**
 * 
 */
	var setting_sys_user_edit = {
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onClick: onClick_sys_user_edit
		}
	};

	var sys_user_edit = {
		context:null
	}
	

	
	function initPassword(userId){
		var param = jQuery.parseJSON('{"userId":"'+userId+'"}');
		ajaxPost('sys/user/initPassword',param);
	}

	function save(){
		console.debug(sessionStorage);
		$("#form_sys_user_edit").attr("action","sys/user/save");
		var $form = $("#form_sys_user_edit");
		if (!$form.valid()) {
			return false;
		}
		if (sessionStorage.getItem("temp_nativePlace"))
			$("#user__nativePlace").val(sessionStorage.getItem("temp_nativePlace"));
		
		if (sessionStorage.getItem("temp_workPlace"))
			$("#user__workPlace").val(sessionStorage.getItem("temp_workPlace"));
		
		ajaxFormSubmit($form,backUrl_sys_user_edit);

		return false;
	}	
	

	function onClick_sys_user_edit(e, treeId, treeNode) {
		$("#user__orgName",sys_user_edit.context).attr("value",treeNode.name);
		$("#user__orgId",sys_user_edit.context).attr("value",treeNode.id);
		hideMenu_sys_user_edit();
	}

	function showMenu_sys_user_edit() {
		var display =$('#menuContent',sys_user_edit.context).css('display');
		if(display == 'none'){
			var $this = $(this);
			//$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
			
			//col-xs-3中的相对位置
			$("#menuContent",sys_user_edit.context).css({left:15 + "px", top: 58 + "px"}).slideDown("fast");
			$("body").bind("mousedown", onBodyDown_sys_user_edit);				
		}			
	}
	
	function hideMenu_sys_user_edit() {
		$("#menuContent",sys_user_edit.context).fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown_sys_user_edit);
	}
	
	function onBodyDown_sys_user_edit(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu_sys_user_edit();
		}
	}
	
	function initCityPanel(){
		try{
			new cityInputHandler("temp_nativePlace");
			new cityInputHandler("temp_workPlace");

		}catch(e){
			console.debug(e);
		}
	}	

	$(function (){
		kedit("user__remark");
		
		sys_user_edit.context = $("#sys_user_edit");
		var orgListTree_sys_user_edit = $.fn.zTree.init($("#orgListTree",sys_user_edit.context), setting_sys_user_edit, zNodes_sys_user_edit);
		console.debug(orgListTree_sys_user_edit);
		orgListTree_sys_user_edit.expandAll(true);
		
		initCityPanel();//加载城市选择面板
		initCitySelector();//绑定城市选择面板上的操作事件		
	});